/* xhr预处理 */
$.ajaxPrefilter(function (options) {
    options.url = 'http://api-breakingnews-web.itheima.net' + options.url
    console.log(options);
    if (options.url.indexOf('/my/') !== -1) {
        options.headers = {
            Authorization: localStorage.getItem('u_token')
        }
    }

    options.complete = function (xhr) {

        if (xhr.responseJSON.status !== 0 && xhr.responseJSON.message === '身份认证失败！') {
            localStorage.removeItem('u_token')
            location.href = './login.html'
        }


    }


})